package com.athbsd.exer6;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * Date:2025/2/24
 * Author：zhouzhou
 * Description:
 */
public class e {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        list.add(11);
        list.add(11);
        list.add(22);
        list.add(11);
        list.add(33);
        list.add(44);
        list.add(33);
        list.add(44);
        list.add(33);
        list.add(44);
        System.out.println(list);
        List newlist = duplicatelist(list);
        System.out.println(newlist);

    }
    public static List duplicatelist(List list) {
        HashSet set =new HashSet<>();
        for (Object o : list) {
            set.add(o);
        }
        List newlist = new ArrayList();
        for (Object o : set) {
            newlist.add(o);
        }
        return new ArrayList(newlist);
    }
}
